package com.gitee.huxing.course.config;

import org.I0Itec.zkclient.exception.ZkMarshallingError;
import org.I0Itec.zkclient.serialize.ZkSerializer;

/**
 * @Description:
 * @ProjectName: gdca-platform
 * @Package: com.gdca.cert.controller
 * @ClassName: ZkSerializer
 * @Author: huxing
 * @DateTime: 2021-08-20 下午3:07
 */
public class ZkCustomSerializer implements ZkSerializer {

    /**
     * @Description: 序列化，数据--》byte[]
     * @Author: huxing
     * @param o
     * @return byte
     * @Date: 2021/8/23 下午3:14
     **/
    @Override
    public byte[] serialize(Object o) throws ZkMarshallingError {
        return String.valueOf(o).getBytes();
    }

    /**
     * @Description: 反序列化，byte[]--->数据
     * @Author: huxing
     * @param bytes
     * @return java.lang.Object
     * @Date: 2021/8/23 下午3:14
     **/
    @Override
    public Object deserialize(byte[] bytes) throws ZkMarshallingError {
        return new String(bytes);
    }
}
